package com.usaas.search.controller.admin;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.usaas.common.core.controller.BaseController;
import com.usaas.common.core.domain.AjaxResult;
import com.usaas.common.enums.BusinessType;
import com.usaas.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.usaas.common.annotation.Log;
import com.usaas.search.dto.PlatUserFeedbackDto;
import com.usaas.search.service.IPlatUserFeedbackService;
/**
 * 用户反馈Controller
 *
 * @author Helios
 * @date 2024-08-14
 */
@RestController
@RequestMapping("/admin/search/platUserFeedback")
public class AdminPlatUserFeedbackController extends BaseController {

    @Autowired
    private IPlatUserFeedbackService platUserFeedbackService;

    /**
     * 查询用户反馈列表
     */
    @PreAuthorize("@ss.hasPermi('search:platUserFeedback:list')")
    @Log(title = "管理端用户反馈list查询", businessType = BusinessType.OTHER)
    @PostMapping("/list")
    public AjaxResult list(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
        List<PlatUserFeedbackDto> list = platUserFeedbackService.queryList(platUserFeedbackDto);
        return AjaxResult.success(list);
    }


    /**
     * 查询用户反馈分页列表
     */
    @PreAuthorize("@ss.hasPermi('search:platUserFeedback:list')")
    @Log(title = "管理端用户反馈page查询", businessType = BusinessType.OTHER)
    @PostMapping("/page")
    public AjaxResult page(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
        return platUserFeedbackService.queryPage(platUserFeedbackDto);
    }


    /**
     * 导出用户反馈列表
     */
    @PreAuthorize("@ss.hasPermi('search:platUserFeedback:export')")
    @Log(title = "管理端导出用户反馈", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response,PlatUserFeedbackDto platUserFeedbackDto) {
        List<PlatUserFeedbackDto> list = platUserFeedbackService.queryList(platUserFeedbackDto);
        ExcelUtil<PlatUserFeedbackDto> util = new ExcelUtil<>(PlatUserFeedbackDto.class);
        util.exportExcel(response, list, "用户反馈数据");
    }

    /**
     * 获取用户反馈详细信息
     */
    @PreAuthorize("@ss.hasPermi('search:platUserFeedback:query')")
    @Log(title = "管理端获取用户反馈详情查询", businessType = BusinessType.OTHER)
    @PostMapping(value = "/getInfo")
    public AjaxResult getInfo(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
        return AjaxResult.success(platUserFeedbackService.queryById(platUserFeedbackDto.getId()));
    }

    /**
     * 新增用户反馈
     */
    @PreAuthorize("@ss.hasPermi('search:platUserFeedback:add')")
    @Log(title = "管理端新增用户反馈", businessType = BusinessType.INSERT)
    @PostMapping(value = "/add")
    public AjaxResult add(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
        return toAjax(platUserFeedbackService.add(platUserFeedbackDto));
    }

    /**
     * 修改用户反馈
     */
    @PreAuthorize("@ss.hasPermi('search:platUserFeedback:edit')")
    @Log(title = "管理端修改用户反馈", businessType = BusinessType.UPDATE)
    @PostMapping(value = "/edit")
    public AjaxResult edit(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
        return toAjax(platUserFeedbackService.update(platUserFeedbackDto));
    }

    /**
     * 删除用户反馈
     */
    @PreAuthorize("@ss.hasPermi('search:platUserFeedback:remove')")
    @Log(title = "管理端删除用户反馈", businessType = BusinessType.DELETE)
    @PostMapping("/del")
    public AjaxResult del(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
        return toAjax(platUserFeedbackService.removeBatch(platUserFeedbackDto.getIds()));
    }

}
